<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org"
	xmlns:layout="http://www.ultraq.net.nz/web/thymeleaf/layout">
<head th:include="inc/home::header">
</head>
<body onload="changeMain('home/all')">
	<!--头部开始   th:href="@{/logout.html}"  -->
	<div class="header">
		<div class="headerl">
			<ul>
				<li><img class="headerl-img" src="images/img_logo.png" /></li>
			</ul>
		</div>
		<div class="headerr">
			<ul>
				<li id="time"></li>
				<li class="user" ><span
					th:text="${session.user.userName}" id="userName"></span><i></i>
					<div class="user-border">
							<p  th:onclick="'javascript:logout();'"  >用户切换</p>
							<p   id="xgPass">修改密码</p>
						</div>
			    </li>
				<li class="close" th:onclick="'javascript:closed();'">退出</li>
			</ul>
		</div>
	</div>
	<!--头部结束-->
	<!--主体开始-->
	<div class="main">
		<!--左边导航开始-->
		<div class="nav">
			<ul>
				<li onclick="changeMain('training')"><img
					src="images/nav_01.png" id="nav_01" />
					<p>交互式培训</p></li>
				<li onclick="changeMain('troubleshooting')"><img
					src="images/nav_02.png" id="nav_02" />
					<p>故障诊断</p></li>
				<li onclick="changeMain('examination')"><img
					src="images/nav_03.png" id="nav_03" />
					<p>考试系统</p></li>
				<li onclick="changeMain('tool')"><img src="images/nav_04.png"
					id="nav_04" />
					<p>常用工具</p></li>
			</ul>
		</div>
		<!--左边导航结束-->
		<!--右边内容开始-->
		<div class="layout-east">
			<div class="layout-east-content">
				<div id="frameReft"></div>
			</div>
		</div>
		<!--右边内容结束-->
		<!--主体结束-->
	</div>
	<!--底部导航ietm/user-help-->
	<div class="foot-nav">
		<div class="foot-nav-b foot-nav-ba">
			<ul id="per">

				<li
					th:style="${session.pm.perCode.contains('ZKJ_homePage')}?'':'display:none'"
					onclick="changeMain('home/all')"><img
					src="images/btn_nav_01_selected.png" id='btn_nav_01' /></li>

				<li
					th:style="${session.pm.perCode.contains('ZKJ_userHelp')}?'':'display:none'"
					onclick="changeMain('userHelp')"><img
					src="images/btn_nav_02.png" id='btn_nav_02' /></li>

				<li
					th:style="${session.pm.perCode.contains('ZKJ_userManage')}?'':'display:none'"
					onclick="changeMain('operation/user/1?timestamp='+new Date().getTime())"><img
					src="images/btn_nav_04.png" id='btn_nav_04' /></li>

				<li
					th:style="${session.pm.perCode.contains('ZKJ_systemSet')}?'':'display:none'"
					onclick="changeMain('settings')"><img
					src="images/btn_nav_05.png" id='btn_nav_05' /></li>

				<li
					th:style="${session.pm.perCode.contains('ZKJ_planManage')}?'':'display:none'"
					onclick="changeMain('operation/plan/1?timestamp='+new Date().getTime())"><img
					src="images/btn_nav_06.png" id='btn_nav_06' /></li>

				<li
					th:style="${session.pm.perCode.contains('ZKJ_selfDiagnose')}?'':'display:none'"
					onclick="changeMain('self-diagnosis')"><img
					src="images/btn_nav_07.png" id='btn_nav_07' /></li>

				<li
					th:style="${session.pm.perCode.contains('ZKJ_systemLog')}?'':'display:none'"
					onclick="changeMain('log')"><img src="images/btn_nav_08.png"
					id='btn_nav_08' /></li>



			</ul>
		</div>
	</div>
</body>

<script th:inline="javascript">  
/*<![CDATA[*/  
    var code =[[${pm.perCode}]];
    if(code!=null){
        var len=code.length;
        var codeName=code.substring(0,len-1).split(",");
        var le=0;
        for (var i=0;i<codeName.length;i++)
        {
        	if(codeName[i].indexOf("ZKJ")>-1){
        		le+=1
        	}
        }

        if(le>=1){
            $(".foot-nav-ba").width(le*160);
        }else{
         	$("#per li").each(function(){
        	    $(this).css('display','block'); 
        	});
            $(".foot-nav-ba").width(7*160);
        }
    }else{
    	$("#per li").each(function(){
    	    $(this).css('display','block'); 
    	});
    	$(".foot-nav-ba").width(7*160);
    }
    function closed(){
		$.Zebra_Dialog('<div class="prompt"><a class="closed-color" href="javascript:void(0)"  onclick="runTime(\'taskkillIE\')"  >退出系统</a><a class="closed-color" href="javascript:void(0)" onclick="runTime(\'shutdown\')" >关机</a></div>', {
            'title':'提示',
            'buttons':[{caption:'取消'}]
        });
	}
    
    function logout(){
    	window.location.href="/logout.html"; 
	}
/*]]>*/  
</script>


<script th:inline="javascript">
	/*<![CDATA[*/
	function runTime(par) {
		 $.ajax({
		     type: "post",
		     dataType: "json",
		     url:"/Tool/"+par ,
		     success: function (data, status) {
		    	 
		     },
		     error: function (data) {
		
		     }
		 }); 
		 

	}

	$(".user").click(function(event){
        event.stopPropagation();//阻止冒泡事件
        $(".user-border").slideToggle();
     });
    
    $(document).click(function(){
        $(".user-border").slideUp('slow');
    });
	
	$('#xgPass').on('click', function(e) {
		e.preventDefault();
		var diag1 = new $.Zebra_Dialog({
			source : {
				'iframe' : {
					'id':'xgPass111',
					'src' : 'password2.html?timestamp='+new Date().getTime(),
					'height' : 200
				}
			},
			width : 600,
			title : '修改密码',
		    buttons:  [ {caption: '保存', callback: function() { 
		                 var data=document.getElementById("xgPass111").contentWindow.passwordReset();
		                 //console.log(data);
		       	    	 if(data.userPassword==""){
				    		 top.$.Zebra_Dialog('<div class="prompt"><div class="success-icon"></div><div class="success-title">旧密码不对!</div></div>', {
						            'title':'提示',
						            'show_close_button':false,
						            'buttons':[    {caption: '确定', callback: function() { 
						             }}]
						         });
				    		 return;
				    	 }else{
				    		 top.$.Zebra_Dialog('<div class="prompt"><div class="success-icon"></div><div class="success-title">密码修改成功!</div></div>', {
						            'title':'提示',
						            'show_close_button':false,
						            'buttons':[    {caption: '确定', callback: function() { 
						            	window.location.href="/"
						             }}]
						         });
				    		 return;
				    	 }
		                  }}
                        ]
		});
	});
	
	/*]]>*/
</script>
</html>
